//导入vue
import Vue from "vue";
//导入路由
import VueRouter from "vue-router";

//导入组件
import Main from "../views/Main";
import Login from "../views/Login";
import UserProFile from "../views/user/ProFile";
import UserList from "../views/user/List";
import CalendarLog from "../views/user/CalendarLogV2";
import NotFound from "../views/NotFound";

//使用路由
Vue.use(VueRouter);

//导出路由
export default new VueRouter({
  mode:'history',
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '*',
      component: NotFound
    },
    {
      path: '/login',
      component: Login
    },
    {
      path: '/main/:name',
      props:true,
      component: Main,
      //嵌套路由
      children:[
        {
          path:'/user/list',
          component:UserList
        },
        {
          path:'/user/profile/:id/:name',
          name:'profile',
          component:UserProFile,
          props:true
        },
        {
          path:'/user/calendarlog',
          component:CalendarLog
        }
      ]
    }
  ]
});
